/*    */ package andriod.service;
/*    */ 
/*    */ import andriod.dao.PersistDao;
/*    */ import com.jcrj.entity.OTask;
/*    */ import com.jcrj.util.DateUtil;
/*    */ import java.util.Date;
/*    */ import java.util.List;
/*    */ 
/*    */ public class ArdTaskService
/*    */ {
/*    */   private PersistDao persistDao;
/*    */ 
/*    */   public List<OTask> getUserTaskList(int userId)
/*    */   {
/* 15 */     String hql = "from OTask where userId=" + userId + 
/* 16 */       " order by creationTime desc";
/* 17 */     return this.persistDao.find(hql);
/*    */   }
/*    */ 
/*    */   public long countUserTask(int userId) {
/* 21 */     String hql = "select count(id) from OTask where userId=" + userId;
/* 22 */     return this.persistDao.findForLong(hql);
/*    */   }
/*    */ 
/*    */   public List<OTask> getTodoTaskList(String userId) {
/* 26 */     String time = DateUtil.DateToString(new Date());
/* 27 */     String hql = "from OTask t where userId in(" + 
/* 28 */       userId + 
/* 29 */       ")  and to_date('" + 
/* 30 */       time + 
/* 31 */       "','yyyy-mm-dd')<= t.endTime and to_date('" + 
/* 32 */       time + 
/* 33 */       "','yyyy-mm-dd')>=t.startTime or (t.id in(select m.taskId from OTaskPeople m where m.userId in(" + 
/* 34 */       userId + ")) and to_date('" + time + 
/* 35 */       "','yyyy-mm-dd')<= t.startTime and  to_date('" + time + 
/* 36 */       "','yyyy-mm-dd')>= t.startTime) order by t.creationTime desc";
/* 37 */     return this.persistDao.find(hql);
/*    */   }
/*    */ 
/*    */   public long countTodoTask(String userId) {
/* 41 */     String time = DateUtil.DateToString(new Date());
/* 42 */     String hql = "select count(id) from OTask t where userId in(" + 
/* 43 */       userId + 
/* 44 */       ")  and  to_date('" + 
/* 45 */       time + 
/* 46 */       "','yyyy-mm-dd')<= t.endTime and  to_date('" + 
/* 47 */       time + 
/* 48 */       "','yyyy-mm-dd')>= t.startTime or (t.id in(select m.taskId from OTaskPeople m where m.userId in(" + 
/* 49 */       userId + ")) and  to_date('" + time + 
/* 50 */       "','yyyy-mm-dd')<= t.endTime and  to_date('" + time + 
/* 51 */       "','yyyy-mm-dd')>= t.startTime)";
/* 52 */     return this.persistDao.findForLong(hql);
/*    */   }
/*    */ 
/*    */   public List<OTask> getNotifyTaskList(int userId) {
/* 56 */     String hql = "from OTask t where t.id in (select m.taskId from OTaskPeople m where m.userId=" + 
/* 57 */       userId + ") order by t.creationTime desc";
/* 58 */     return this.persistDao.find(hql);
/*    */   }
/*    */ 
/*    */   public long countNotifyTask(int userId) {
/* 62 */     String hql = "select count(t.id) from OTask t where  t.id in(select m.taskId from OTaskPeople m where m.userId=" + 
/* 63 */       userId + ")";
/* 64 */     return this.persistDao.findForLong(hql);
/*    */   }
/*    */ 
/*    */   public PersistDao getPersistDao() {
/* 68 */     return this.persistDao;
/*    */   }
/*    */ 
/*    */   public void setPersistDao(PersistDao persistDao) {
/* 72 */     this.persistDao = persistDao;
/*    */   }
/*    */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     andriod.service.ArdTaskService
 * JD-Core Version:    0.6.0
 */